#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main()
{
	int sockfd = socket(PF_INET  , SOCK_STREAM , 0);
	struct sockaddr_in addr;
	addr.sin_family = PF_INET  ;
	addr.sin_port = htons(2222);
	addr.sin_addr.s_addr = inet_addr("127.0.0.1");
	int res = connect(sockfd , (struct sockaddr*)&addr , sizeof(addr));
	while(1)
	{
		//send
		char buf[100];
		printf("to server : ");
		scanf("%s",buf);
		write(sockfd , buf , sizeof(buf));
		if(strcmp(buf,"bye") == 0)
			break;
		//recevie
		//char word[100];		
		//read(sockfd , word , sizeof(word));
		//printf("from server : %s\n",word);	
	}

	close(sockfd);
}
